package cn.iocoder.yudao.module.polling.dal.mysql.pollingproject;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.polling.controller.admin.pollingproject.vo.PollingProjectExportReqVO;
import cn.iocoder.yudao.module.polling.controller.admin.pollingproject.vo.PollingProjectIOVO;
import cn.iocoder.yudao.module.polling.controller.admin.pollingproject.vo.PollingProjectPageReqVO;
import cn.iocoder.yudao.module.polling.dal.dataobject.pollingproject.PollingProjectDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 巡检项目 Mapper
 *
 * @author 左达成
 */
@Mapper
public interface PollingProjectMapper extends BaseMapperX<PollingProjectDO> {

    default PageResult<PollingProjectDO> selectPage(PollingProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PollingProjectDO>()
                .eqIfPresent(PollingProjectDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(PollingProjectDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PollingProjectDO::getUpdater, reqVO.getUpdater())
                .eqIfPresent(PollingProjectDO::getFfId, reqVO.getFfId())
                .eqIfPresent(PollingProjectDO::getPpCode, reqVO.getPpCode())
                .eqIfPresent(PollingProjectDO::getPtId, reqVO.getPtId())
                .eqIfPresent(PollingProjectDO::getPpMethod, reqVO.getPpMethod())
                .eqIfPresent(PollingProjectDO::getPpType, reqVO.getPpType())
                .eqIfPresent(PollingProjectDO::getPpUpperLimit, reqVO.getPpUpperLimit())
                .eqIfPresent(PollingProjectDO::getPpLowerLimit, reqVO.getPpLowerLimit())
                .eqIfPresent(PollingProjectDO::getPpOptions, reqVO.getPpOptions())
                .eqIfPresent(PollingProjectDO::getPpNormal, reqVO.getPpNormal())
                .eqIfPresent(PollingProjectDO::getPpPicturesState, reqVO.getPpPicturesState())
                .eqIfPresent(PollingProjectDO::getPpPictures, reqVO.getPpPictures())
                .eqIfPresent(PollingProjectDO::getCrId, reqVO.getCrId())
                .eqIfPresent(PollingProjectDO::getPpName, reqVO.getPpName())
                .orderByDesc(PollingProjectDO::getId));
    }

    default List<PollingProjectDO> selectList(PollingProjectExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PollingProjectDO>()
                .eqIfPresent(PollingProjectDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(PollingProjectDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PollingProjectDO::getUpdater, reqVO.getUpdater())
                .eqIfPresent(PollingProjectDO::getFfId, reqVO.getFfId())
                .eqIfPresent(PollingProjectDO::getPpCode, reqVO.getPpCode())
                .eqIfPresent(PollingProjectDO::getPtId, reqVO.getPtId())
                .eqIfPresent(PollingProjectDO::getPpMethod, reqVO.getPpMethod())
                .eqIfPresent(PollingProjectDO::getPpType, reqVO.getPpType())
                .eqIfPresent(PollingProjectDO::getPpUpperLimit, reqVO.getPpUpperLimit())
                .eqIfPresent(PollingProjectDO::getPpLowerLimit, reqVO.getPpLowerLimit())
                .eqIfPresent(PollingProjectDO::getPpOptions, reqVO.getPpOptions())
                .eqIfPresent(PollingProjectDO::getPpNormal, reqVO.getPpNormal())
                .eqIfPresent(PollingProjectDO::getPpPicturesState, reqVO.getPpPicturesState())
                .eqIfPresent(PollingProjectDO::getPpPictures, reqVO.getPpPictures())
                .eqIfPresent(PollingProjectDO::getCrId, reqVO.getCrId())
                .eqIfPresent(PollingProjectDO::getPpName, reqVO.getPpName())
                .orderByDesc(PollingProjectDO::getId));
    }

    List<PollingProjectIOVO> selectByMyList(PollingProjectIOVO pollingProjectIOVO);
    List<PollingProjectIOVO> selectProjectByBzId(PollingProjectIOVO pollingProjectIOVO);

}
